package com.example.pathprotectsystem.utils;

import java.util.HashMap;

public class LiQingCentCalculateUtil {
    private static int[][] a = {
            {3,5,8,16,38,48},
            {5,8,10,20,45,70},
            {8,10,15,30,55,80},
            {3,10,15,30,52,65},
            {2,7,12,25,45,55},
            {3,5,12,25,47,63},
            {10,15,20,40,65,80},
            {2,5,8,15,35,45},
            {10,15,25,40,65,72},
            {2,4,8,15,30,40},
            {3,8,12,12,12,12},
            {5,10,15,25,50,80},
            {2,4,8,20,40,70}
    };
    private static HashMap<String,Integer> m = new HashMap<>(){{
        put("线裂",0);
        put("网裂",1);
        put("龟裂",2);
        put("拥包",3);
        put("车辙",4);
        put("沉陷",5);
        put("翻浆",6);
        put("剥落",7);
        put("坑槽",8);
        put("啃边",9);
        put("路框差",10);
        put("唧浆",11);
        put("泛油",12);
    }};
    public static int getCol(double damageP){
        if(damageP<0.1)return 0;
        if(damageP<1)return 1;
        if(damageP<10)return 2;
        if(damageP<50)return 3;
        if(damageP<100)return 4;
        return 5;
    }
    public static int getDownCent(String damageType,double damageP){
        int cent = 0;
        int col = getCol(damageP);
        int row = m.get(damageType);
        if(damageP<0.01)return cent;
        cent=a[row][col];
        return cent;
    }

}
